package com.hgsoft.yfzx.component.filehelper.entity;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

/**
 * description
 *
 * @author RuiHaoZ on hgits.cn
 * @date 2019/1/15 15:16
 */
public class Timer {
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private Long cost;

    public Timer() {
        startTime = LocalDateTime.now();
    }

    public void startTimer() {
        startTime = LocalDateTime.now();
    }

    public void endTimer() {
        endTime = LocalDateTime.now();
        cost = ChronoUnit.MILLIS.between(startTime, endTime);
    }

    public Long getCost() {
        return cost;
    }

    public void setCost(Long cost) {
        this.cost = cost;
    }
}
